home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / full / CBUILDER / SAMS / SAMPLES / CHAP06 / VIEWMAIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-12  |  1.9 KB  |  62 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "ViewMain.h"
  6. #include "MDIChild.h"
  7. #include "PVAbout.h"
  8. //---------------------------------------------------------------------------
  9. #pragma resource "*.dfm"
  10. TMainForm *MainForm;
  11. //---------------------------------------------------------------------------
  12. __fastcall TMainForm::TMainForm(TComponent* Owner)
  13.   : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TMainForm::Open1Click(TObject *Sender)
  18. {
  19.     if (OpenDialog->Execute())
  20.   {
  21.       TChild* child = new TChild(this);
  22.     child->Parent = this;
  23.       child->Image->Picture->LoadFromFile(OpenDialog->FileName);
  24.     child->ClientWidth = child->Image->Picture->Width;
  25.     child->ClientHeight = child->Image->Picture->Height;
  26.     child->Caption = OpenDialog->FileName;
  27.       child->Show();
  28.   }
  29. }
  30. //---------------------------------------------------------------------
  31. void __fastcall TMainForm::Tile1Click(TObject *Sender)
  32. {
  33.     Tile();
  34. }
  35. //---------------------------------------------------------------------
  36. void __fastcall TMainForm::Cascade1Click(TObject *Sender)
  37. {
  38.     Cascade();  
  39. }
  40. //---------------------------------------------------------------------
  41. void __fastcall TMainForm::ArrangeAll1Click(TObject *Sender)
  42. {
  43.     ArrangeIcons();  
  44. }
  45. //---------------------------------------------------------------------
  46. void __fastcall TMainForm::SaveAs1Click(TObject *Sender)
  47. {
  48.   TChild* child =
  49.     dynamic_cast<TChild*>(ActiveMDIChild);
  50.   if (!child) return;
  51.   if (SaveDialog->Execute())
  52.   {
  53.     child->Image->Picture->SaveToFile(SaveDialog->FileName);
  54.   }
  55. }
  56. //---------------------------------------------------------------------
  57. void __fastcall TMainForm::About1Click(TObject *Sender)
  58. {
  59.     AboutBox->ShowModal();  
  60. }
  61. //---------------------------------------------------------------------
  62.